package com.application.moneycalculator.activity;

import com.application.moneycalculator.data.ExpenseItem;
import com.application.moneycalculator.db.MoneyCalculator;
import com.application.moneycalculator.log.Log_;
import com.application.moneycalculator.utils.DateUtils;

import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;

public class TestThread extends Thread{ //implements Runnable{

	private Context context;
	
	public TestThread(Context context_) {
		super();
		this.context = context_;
	}
	
	public void run()
	{
		ContentResolver cr = context.getContentResolver();
		ContentValues values = new ContentValues();

		for(int i=101; i < 100; i++)
		{
			values.clear();
			
			values.put(MoneyCalculator.Expense.EXPENSES_TABLE_FIELD_EXPENSE_DATE, DateUtils.convertExpenseToString(new ExpenseItem(DateUtils.getCurrentDate())));
			values.put(MoneyCalculator.Expense.EXPENSES_TABLE_FIELD_EXPENSE_AMOUNT, i);
			values.put(MoneyCalculator.Expense.EXPENSES_TABLE_FIELD_EXPENSE_CURRENCY, "$$$");
			
			Log_.out("TEST THREAD", "" + i);
			cr.insert(MoneyCalculator.Expense.CONTENT_URI, values);
			
			try {
				Thread.sleep(1000);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
	}
}
